<?php
	require_once(realpath(dirname(__FILE__)) . "/../../classes/Commande.class.php");
	
	/* Substitutions de type commande */
		
	function substitcommande($texte){
		global $commande;
		
		if($commande) $refs = $commande;
		else $refs = $_SESSION['navig']->commande->ref;


		$texte = str_replace("#COMMANDE_TRANSPORT",  $_SESSION['navig']->commande->transport, $texte);
	
		$tcommande = new Commande();
	
		$query = "select * from $tcommande->table where ref='" . $refs . "'";
		$resul = mysql_query($query, $tcommande->link);
		$row = mysql_fetch_object($resul);	
		$texte = str_replace("#COMMANDE_ID", "$row->id", $texte);
		$texte = str_replace("#COMMANDE_REF", "$row->ref", $texte);
		$texte = str_replace("#COMMANDE_TRANSACTION", "$row->transaction", $texte);

		return $texte;
	}
	
?>